package com.icss.flow.enums;

import lombok.AllArgsConstructor;
import lombok.Getter;

@AllArgsConstructor
@Getter
public enum FilterEnum {

    //包含
    LIKE("LK", " like  concat ('%%','%s','%%')"),
    //不包含
    NLK("NLK", "not like concat ('%%','%s','%%')"),
    //等于
    EQ("EQ", "== \"%s\""),
    //不等于
    NEQ("NEQ", "!= \"%s\""),
    //为空
    NL("NL", "is null"),
    //不为空
    NT("NT", "is not null");
    private final String op;
    private final String template;

    public static FilterEnum getOp(String extName) {
        for (FilterEnum value : FilterEnum.values()) {
            if (value.getOp().equalsIgnoreCase(extName)) {
                return value;
            }
        }
        return LIKE;
    }
}
